package cn.kgc.mes.type.service.impl;

import java.util.List;
import cn.kgc.mes.common.utils.DateUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.kgc.mes.type.mapper.WorkshopMapper;
import cn.kgc.mes.type.domain.Workshop;
import cn.kgc.mes.type.service.IWorkshopService;

/**
 * 车间Service业务层处理
 * 
 * @author ydw
 * @date 2025-09-10
 */
@Service
public class WorkshopServiceImpl extends ServiceImpl<WorkshopMapper, Workshop> implements IWorkshopService
{
    @Autowired
    private WorkshopMapper workshopMapper;

    /**
     * 查询车间
     * 
     * @param workshopId 车间主键
     * @return 车间
     */
    @Override
    public Workshop selectWorkshopByWorkshopId(Long workshopId)
    {
        return workshopMapper.selectWorkshopByWorkshopId(workshopId);
    }

    /**
     * 查询车间列表
     * 
     * @param workshop 车间
     * @return 车间
     */
    @Override
    public List<Workshop> selectWorkshopList(Workshop workshop)
    {
        return workshopMapper.selectWorkshopList(workshop);
    }

    /**
     * 新增车间
     * 
     * @param workshop 车间
     * @return 结果
     */
    @Override
    public int insertWorkshop(Workshop workshop)
    {
        workshop.setCreateTime(DateUtils.getNowDate());
        return workshopMapper.insertWorkshop(workshop);
    }

    /**
     * 修改车间
     * 
     * @param workshop 车间
     * @return 结果
     */
    @Override
    public int updateWorkshop(Workshop workshop)
    {
        workshop.setUpdateTime(DateUtils.getNowDate());
        return workshopMapper.updateWorkshop(workshop);
    }

    /**
     * 批量删除车间
     * 
     * @param workshopIds 需要删除的车间主键
     * @return 结果
     */
    @Override
    public int deleteWorkshopByWorkshopIds(Long[] workshopIds)
    {
        return workshopMapper.deleteWorkshopByWorkshopIds(workshopIds);
    }

    /**
     * 删除车间信息
     * 
     * @param workshopId 车间主键
     * @return 结果
     */
    @Override
    public int deleteWorkshopByWorkshopId(Long workshopId)
    {
        return workshopMapper.deleteWorkshopByWorkshopId(workshopId);
    }
}
